﻿using System;
using System.Collections.Generic;
using System.Linq;
using GdNet.Core.Dto;
using GdNet.WebFramework.Domain.ContentManagement;

namespace GdNet.WebFramework.Modules.ContentManagement.Dtos
{
    public sealed class ContentItemDto : AbstractEntityWithModificationDto<ContentItem, Guid>
    {
        public string Name
        {
            get;
            set;
        }

        public string Description
        {
            get;
            set;
        }

        public string Keywords
        {
            get;
            set;
        }

        public IList<ContentPartDto> Parts { get; protected set; }

        public ContentItemDto(ContentItem item)
            : base(item)
        {
            this.Name = item.Name;
            this.Description = item.Description;
            this.Keywords = item.Keywords;
            this.Parts = item.Parts.Select(x => new ContentPartDto(x)).ToList();
        }
    }
}
